package com.jiayang.hhotel.ui;

import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.CompoundButton;
import android.widget.EditText;
import android.widget.RadioButton;
import android.widget.TextView;

import com.jiayang.hhotel.R;
import com.jiayang.hhotel.presenter.ContractRoomPriceAddedPresenter;

import cn.droidlover.xdroidmvp.mvp.XActivity;

/**
 * Created by Administrator on 2017/5/27 0027.
 * 合同房价新增页面
 */

public class ContractRoomPriceAddedActivity extends XActivity<ContractRoomPriceAddedPresenter> implements CompoundButton.OnCheckedChangeListener, View.OnClickListener {

    private TextView selContractTime;//选择合同时间
    private TextView selRoomGrade;//选择房间等级
    private TextView selGrade;//选择等级
    private TextView selTuanHuiPackage;//选择团会package
    private TextView selSanKePackage;//选择散客package
    private EditText etMaxCount;//最大可订房数
    private EditText etTuanHuiPrice;//团会房价
    private EditText etMoney;//金额百分比
    private EditText etSanKePrice;//散客房价
    private RadioButton rbTuanHuiMoney,rbTuanHuiPercentage;//团会佣金类型金额/百分比
    private RadioButton rbSanKeMoney,rbSanKePercentage;//散客佣金类型金额/百分比
    private Button btSave;//保存

    @Override
    public void initData(Bundle savedInstanceState) {
        initTitle(this,true,getString(R.string.newly_added),R.color.orange_color,null,null);
        selContractTime= (TextView) findViewById(R.id.bt_contact_time_sel);
        selRoomGrade= (TextView) findViewById(R.id.bt_room_grade_sel);
        selGrade= (TextView) findViewById(R.id.bt_grade_sel);
        selTuanHuiPackage= (TextView) findViewById(R.id.bt_tuanhui_package_sel);
        selSanKePackage= (TextView) findViewById(R.id.bt_sanke_package);

        etMaxCount= (EditText) findViewById(R.id.bt_count);
        etTuanHuiPrice= (EditText) findViewById(R.id.bt_price);
        etMoney= (EditText) findViewById(R.id.bt_money_or_percentage);
        etSanKePrice= (EditText) findViewById(R.id.bt_sanke_price);

        rbTuanHuiMoney= (RadioButton) findViewById(R.id.rb_tuanhui_money);
        rbTuanHuiPercentage= (RadioButton) findViewById(R.id.rb_tuanhui_baifenbi);
        rbSanKeMoney= (RadioButton) findViewById(R.id.rb_sanke_money);
        rbSanKePercentage= (RadioButton) findViewById(R.id.rb_sanke_baifenbi);

        btSave= (Button) findViewById(R.id.bt_save);

        rbTuanHuiMoney.setOnCheckedChangeListener(this);
        rbTuanHuiPercentage.setOnCheckedChangeListener(this);
        rbSanKeMoney.setOnCheckedChangeListener(this);
        rbSanKePercentage.setOnCheckedChangeListener(this)
        ;
        selContractTime.setOnClickListener(this);
        selRoomGrade.setOnClickListener(this);
        selGrade.setOnClickListener(this);
        selTuanHuiPackage.setOnClickListener(this);
        selSanKePackage.setOnClickListener(this);
        btSave.setOnClickListener(this);
    }

    @Override
    public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
        switch (buttonView.getId()){
            case R.id.rb_tuanhui_money://团会金额
                break;
            case R.id.rb_tuanhui_baifenbi://团会百分比
                break;
            case R.id.rb_sanke_money://散客金额
                break;
            case R.id.rb_sanke_baifenbi://散客百分比
                break;
        }
    }

    @Override
    public void onClick(View v) {
        switch (v.getId()){
            case R.id.bt_contact_time_sel://合同时间
                break;
            case R.id.bt_room_grade_sel://房间等级
                break;
            case R.id.bt_grade_sel://等级
                break;
            case R.id.bt_tuanhui_package_sel://团会package
                break;
            case R.id.bt_sanke_package://散客package
                break;
            case R.id.bt_save://保存
                break;
        }
    }

    @Override
    public int getLayoutId() {
        return R.layout.layout_contract_room_price_added;
    }

    @Override
    public ContractRoomPriceAddedPresenter newP() {
        return new ContractRoomPriceAddedPresenter();
    }

}
